<?php

namespace Viettrans\FrontBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Viettrans\FrontBundle\Entity\ServicePro
 *
 * @ORM\Table(name="servicepro")
 * @ORM\HasLifecycleCallbacks()
 * @ORM\Entity(repositoryClass="Viettrans\FrontBundle\Entity\ServiceProRepository")
 */
class ServicePro {
/*******************************************************************************
* Begin of user's definitions
*******************************************************************************/
    private $locality;
    private $typeName;
    private $categoryName;
    private $photo;
    private $thumb;
    
    public function getLocality() {
        return $this->locality;
    }
    
    public function setLocality($locality) {
        $this->locality = $locality;
    }

    public function getTypeName() {
        return $this->typeName;
    }
    
    public function setTypeName($typeName) {
        $this->typeName = $typeName;
    }
    
    public function getCategoryName() {
        return $this->categoryName;
    }
    
    public function setPhoto($photo) {
        $this->photo = $photo;
    }
    
    public function getPhoto(){
        return $this->photo;
    }

    public function setThumb($thumb) {
        $this->thumb = $thumb;
    }
    
    public function getThumb(){
        return $this->thumb;
    }
    
    public function setCategoryName($categoryName) {
        $this->categoryName = $categoryName;
    }

    public function getTypeObj() {
        return $this->type;
    }
    
    public function getTownObj() {
        return $this->town;
    }

    public function getUserObj() {
        return $this->user;
    }
    
    public function getDepartmentObj() {
        return $this->department;
    }
    
    public function getCategoryObj() {
        return $this->category;
    }

    /**
    * @ORM\ManyToOne(targetEntity="User", inversedBy="announcements")
    * @ORM\JoinColumn(name="userId", referencedColumnName="id")
    */
    protected $user;
	
    /**
    * @ORM\ManyToOne(targetEntity="Type", inversedBy="announcements")
    * @ORM\JoinColumn(name="typeId", referencedColumnName="id")
    */
    protected $type;
    
    /**
    * @ORM\ManyToOne(targetEntity="Town", inversedBy="announcements")
    * @ORM\JoinColumn(name="townId", referencedColumnName="id")
    */
    protected $town;
    
    /**
    * @ORM\ManyToOne(targetEntity="Department", inversedBy="announcements")
    * @ORM\JoinColumn(name="departmentId", referencedColumnName="id")
    */
    protected $department;

    /**
    * @ORM\ManyToOne(targetEntity="Category", inversedBy="announcements")
    * @ORM\JoinColumn(name="categoryId", referencedColumnName="id")
    */
    protected $category;
    
    /**
    * @ORM\prePersist
    */
    public function setDefaultValues() {
		$now = new \DateTime();
	
        if (!isset($this->createdAt)) $this->createdAt = $now;
        
        if (!isset($this->updatedAt)) $this->updatedAt = $now;
        
        if (!isset($this->expiresAt)) $this->expiresAt = $now;
        
        if (!isset($this->beginsAt)) $this->beginsAt = $now;
        
        if (!isset($this->validatedAt)) $this->validatedAt = $now;
		
		if (!isset($this->isActivated)) $this->isActivated = false;
    }
	
/*******************************************************************************
* End of user's definitions
*******************************************************************************/    
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var integer $userId
     *
     * @ORM\Column(name="userId", type="integer")
     */
    private $userId;
	
    /**
     * @var integer $typeId
     *
     * @ORM\Column(name="typeId", type="integer", nullable=true)
     */
    private $typeId;

    /**
     * @var integer $categoryId
     *
     * @ORM\Column(name="categoryId", type="integer")
     */
    private $categoryId;
    
    /**
     * @var integer $departmentId
     *
     * @ORM\Column(name="departmentId", type="integer")
     */
    private $departmentId;

    /**
     * @var integer $townId
     *
     * @ORM\Column(name="townId", type="integer")
     */
    private $townId;

    /**
     * @var string $contactName
     *
     * @ORM\Column(name="contactName", type="string", length=50)
     * @Assert\NotBlank(message="Tên liên hệ không được để trống.")
     * @Assert\MaxLength(limit=50, message="Tên liên hệ tối đa là 50 kí tự.")
     */
    private $contactName;

    /**
     * @var string $contactEmail
     *
     * @ORM\Column(name="contactEmail", type="string", length=100)
     * @Assert\NotBlank(message="Email liên hệ không được để trống.")
     * @Assert\MaxLength(limit=100, message="Email liên hệ tối đa là 100 kí tự.")
     * @Assert\Regex(pattern="/^[-a-z0-9!#$%&'*+\/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+\/=?^_`{|}~]+)*@(([a-z0-9]([-a-z0-9]*[a-z0-9]+)?){1,63}\.)+([a-z0-9]([-a-z0-9]*[a-z0-9]+)?){2,63}$/i", message="Email không hợp lệ.")
     */
    private $contactEmail;

    /**
     * @var string $contactTelephone
     *
     * @ORM\Column(name="contactTelephone", type="string", length=15, nullable=true)
     * @Assert\Regex(pattern="/^\d{8,15}$/", message="Điện thoại không hợp lệ (8-15 số).")
     */
    private $contactTelephone;

    /**
     * @var string $contactAddress
     *
     * @ORM\Column(name="contactAddress", type="string", length=255)
     * @Assert\NotBlank(message="Địa chỉ không được để trống.")
     * @Assert\MaxLength(limit=255, message="Địa chỉ tối đa là 255 kí tự.")
     */
    private $contactAddress;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=100)
     * @Assert\NotBlank(message="Tên dịch vụ không được để trống.")
     * @Assert\MaxLength(limit=100, message="Tên dịch vụ tối đa là 100 kí tự.")
     */
    private $name;
	
    /**
     * @var text $description
     *
     * @ORM\Column(name="description", type="text")
     * @Assert\NotBlank(message="Nội dung tin không được để trống.")
     * @Assert\MaxLength(limit=2000, message="Nội dung tin tối đa là 2000 kí tự.")
     */
    private $description;

    /**
     * @var string $photos
     *
     * @ORM\Column(name="photos", type="string", length=255, nullable=true)
     * @Assert\File(
     * 		maxSize            = "1M",
     * 		maxSizeMessage     = "Kích thước file không hợp lệ (tối đa 1Mb).",
     * 		notFoundMessage    = "Không tìm thấy file.",
     * 		mimeTypes          = {"image/png", "image/jpeg", "image/gif", "image/jpg"},
     * 		mimeTypesMessage   = "File không hợp lệ (File hợp lệ: .png, .jpeg, .jpg, .gif).",
     * 		notReadableMessage = "Có lỗi khi đọc file."
     * )
     */
    private $photos;

    /**
     * @var bool $isActivated
     *
     * @ORM\Column(name="isActivated", type="boolean")
     */
    private $isActivated;
	
    /**
     * @var datetime $createdAt
     *
     * @ORM\Column(name="createdAt", type="datetime")
     */
    private $createdAt;

    /**
     * @var datetime $activatedAt
     *
     * @ORM\Column(name="activatedAt", type="datetime")
     */
    private $activatedAt;
	
    /**
     * @var datetime $updatedAt
     *
     * @ORM\Column(name="updatedAt", type="datetime")
     */
    private $updatedAt;

    /**
     * @var datetime $validatedAt
     *
     * @ORM\Column(name="validatedAt", type="datetime")
     */
    private $validatedAt;

    /**
     * @var datetime $beginsAt
     *
     * @ORM\Column(name="beginsAt", type="datetime")
     */
    private $beginsAt;

    /**
     * @var datetime $expiresAt
     *
     * @ORM\Column(name="expiresAt", type="datetime")
     */
    private $expiresAt;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set userId
     *
     * @param integer $userId
     */
    public function setUserId($userId)
    {
        $this->userId = $userId;
    }

    /**
     * Get userId
     *
     * @return integer 
     */
    public function getUserId()
    {
        return $this->userId;
    }
	
    /**
     * Set typeId
     *
     * @param integer $typeId
     */
    public function setTypeId($typeId)
    {
        $this->typeId = $typeId;
    }

    /**
     * Get typeId
     *
     * @return integer 
     */
    public function getTypeId()
    {
        return $this->typeId;
    }

    /**
     * Set categoryId
     *
     * @param integer $categoryId
     */
    public function setCategoryId($categoryId)
    {
        $this->categoryId = $categoryId;
    }

    /**
     * Get categoryId
     *
     * @return integer 
     */
    public function getCategoryId()
    {
        return $this->categoryId;
    }
    
    /**
     * Set departmentId
     *
     * @param integer $departmentId
     */
    public function setDepartmentId($departmentId)
    {
        $this->departmentId = $departmentId;
    }

    /**
     * Get departmentId
     *
     * @return integer 
     */
    public function getDepartmentId()
    {
        return $this->departmentId;
    }

    /**
     * Set townId
     *
     * @param integer $townId
     */
    public function setTownId($townId)
    {
        $this->townId = $townId;
    }

    /**
     * Get townId
     *
     * @return integer 
     */
    public function getTownId()
    {
        return $this->townId;
    }

    /**
     * Set contactAddress
     *
     * @param string $contactAddress
     */
    public function setContactAddress($contactAddress)
    {
        $this->contactAddress = $contactAddress;
    }

    /**
     * Get contactAddress
     *
     * @return string 
     */
    public function getContactAddress()
    {
        return $this->contactAddress;
    }
	
    /**
     * Set contactName
     *
     * @param string $contactName
     */
    public function setContactName($contactName)
    {
        $this->contactName = $contactName;
    }

    /**
     * Get contactName
     *
     * @return string 
     */
    public function getContactName()
    {
        return $this->contactName;
    }

    /**
     * Set contactEmail
     *
     * @param string $contactEmail
     */
    public function setContactEmail($contactEmail)
    {
        $this->contactEmail = $contactEmail;
    }

    /**
     * Get contactEmail
     *
     * @return string 
     */
    public function getContactEmail()
    {
        return $this->contactEmail;
    }

    /**
     * Set contactTelephone
     *
     * @param string $contactTelephone
     */
    public function setContactTelephone($contactTelephone)
    {
        $this->contactTelephone = $contactTelephone;
    }

    /**
     * Get contactTelephone
     *
     * @return string 
     */
    public function getContactTelephone()
    {
        return $this->contactTelephone;
    }

    /**
     * Set name
     *
     * @param text $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return text 
     */
    public function getName()
    {
        return $this->name;
    }	
	
    /**
     * Set description
     *
     * @param text $description
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }

    /**
     * Get description
     *
     * @return text 
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set photos
     *
     * @param string $photos
     */
    public function setPhotos($photos)
    {
        $this->photos = $photos;
    }

    /**
     * Get photos
     *
     * @return string 
     */
    public function getPhotos()
    {
        return $this->photos;
    }

	/**
     * Set isActivated
     *
     * @param bool
     */
    public function setIsActivated($isActivated)
    {
        $this->isActivated = $isActivated;
    }

    /**
     * Get isActivated
     *
     * @return bool 
     */
    public function getIsActivated()
    {
        return $this->isActivated;
    }
	
    /**
     * Set createdAt
     *
     * @param datetime $createdAt
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;
    }

    /**
     * Get createdAt
     *
     * @return datetime 
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedAt
     *
     * @param datetime $updatedAt
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;
    }

    /**
     * Get updatedAt
     *
     * @return datetime 
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Set activatedAt
     *
     * @param datetime $activatedAt
     */
    public function setActivatedAt($activatedAt)
    {
        $this->activatedAt = $activatedAt;
    }

    /**
     * Get activatedAt
     *
     * @return datetime 
     */
    public function getActivatedAt()
    {
        return $this->activatedAt;
    }
	
    /**
     * Set validatedAt
     *
     * @param datetime $validatedAt
     */
    public function setValidatedAt($validatedAt)
    {
        $this->validatedAt = $validatedAt;
    }

    /**
     * Get validatedAt
     *
     * @return datetime 
     */
    public function getValidatedAt()
    {
        return $this->validatedAt;
    }

    /**
     * Set beginsAt
     *
     * @param datetime $beginsAt
     */
    public function setBeginsAt($beginsAt)
    {
        $this->beginsAt = $beginsAt;
    }

    /**
     * Get beginsAt
     *
     * @return datetime 
     */
    public function getBeginsAt()
    {
        return $this->beginsAt;
    }

    /**
     * Set expiresAt
     *
     * @param datetime $expiresAt
     */
    public function setExpiresAt($expiresAt)
    {
        $this->expiresAt = $expiresAt;
    }

    /**
     * Get expiresAt
     *
     * @return datetime 
     */
    public function getExpiresAt()
    {
        return $this->expiresAt;
    }
}